/**
 * Created by 小敏哥 on 2018/2/8.
 */
//获取应用实例
var app = getApp();
var data = {};
Page({
    data: {
        remark:'',
        mailboxNum:'',
    },
    onLoad(options) {
      if(app.getStorageSync('mailboxNumData')){
          data.remark=app.getStorageSync('mailboxNumData').remark;
          data.mailboxNum=app.getStorageSync('mailboxNumData').mailboxNum;
          this.setData({
              remark:app.getStorageSync('mailboxNumData').remark,
              mailboxNum:app.getStorageSync('mailboxNumData').mailboxNum
          });
      }
    },
    save() {
        let dataObj = {
            remark: data.remark,
            id:app.getStorageSync('mailboxNumData').id,
        };
        let opt = {
            url: app.globalData.host + "/wx/ad/updateMailboxNum.ajax",
            data: dataObj,
            sucFn: (result) => {
                if (result.code == 1000) {
                    wx.navigateBack();
                }
                else {
                    wx.showToast({
                        title: result.msg,
                        icon: 'none',
                        duration: 2000
                    });
                }
            }
        };
        app.ajax(opt);
    },

    cancel() {
        wx.navigateBack();
    },
    remarkChange(e) {
        data.remark = e.detail.value
    }
});